[https://nvbugs/6507080][fix] Override TokenizerBase.__repr__ to return f"{self.__class__.__name__}()"…#16839
Open
trtllm-agent wants to merge 2 commits into
Open
[https://nvbugs/6507080][fix] Override TokenizerBase.__repr__ to return f"{self.__class__.__name__}()"…#16839trtllm-agent wants to merge 2 commits into
TokenizerBase.__repr__ to return f"{self.__class__.__name__}()"…#16839trtllm-agent wants to merge 2 commits into
Conversation
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
WalkthroughAdds a fallback ChangesTokenizer representation and test enablement
Estimated code review effort: 1 (Trivial) | ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
PreTrainedTokenizerBase.__repr__ reads properties (e.g.
added_tokens_decoder) that TokenizerBase subclasses are not required
to implement. When a user-supplied custom tokenizer becomes a field of
the pydantic llm_args model, logging f"LLM Args:\n{llm_args}" in
py_executor_creator triggers pydantic's __repr__, which recursively
calls repr() on the tokenizer and blows up with NotImplementedError.
Override __repr__ on TokenizerBase to return a class-name-only string
so pydantic reprs and startup logging never crash on custom tokenizers.
Signed-off-by: handongl <handongl@nvidia.com>
Signed-off-by: handongl <handongl@nvidia.com>
trtllm-agent
force-pushed
the
repair-bot-bug6507080
branch
from
July 24, 2026 19:36
e0af668 to
30b981f
Compare
trtllm-agent
requested review from
QiJune,
StanleySun639,
dpitman-nvda,
schetlur-nv and
yiqingy0
July 24, 2026 19:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
__repr__, which reads the abstractadded_tokens_decoderproperty and raisesNotImplementedErroron user protocol subclassesTokenizerBase.__repr__to returnf"{self.__class__.__name__}()"so pydantic/logging never touches transformers-internal state on custom tokenizersTest plan
Links
Dev Engineer Review
TokenizerBaseintensorrt_llm/tokenizer/tokenizer.pyto override__repr__, returningf"{self.__class__.__name__}()".PreTrainedTokenizerBase.__repr__from touching tokenizer properties (e.g.,added_tokens_decoder) thatTokenizerBasesubclasses may not implement, avoidingNotImplementedErrorduring pydantic representation and startup/logging.QA Engineer Review
tests/integration/test_lists/waives.txtunittest/llmapi/test_llm.py::test_llm_with_customized_tokenizer(no entries added).